package com.example.mapper;

import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.example.pojo.dto.*;
import com.example.pojo.entity.Book;
import com.example.pojo.entity.Employee;
import com.example.pojo.entity.User;
import org.apache.ibatis.annotations.Delete;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Select;

import java.util.List;

@Mapper
public interface UserMapper extends BaseMapper<Employee> {
    /**
     * 新增职工
     *
     * @param userInsertDTO
     */
    Integer insertUser(UserInsertDTO userInsertDTO);

    /**
     * 删除用户
     * @param id
     */
    @Delete("delete from tb_user where id=#{id};")
    void deleteUser(Long id);

    /**
     * 修改员工信息
     */
    void updateUser(UserUpdateDTO userUpdateDTO);

    /**
     * 查询用户信息
     *
     * @param id
     * @return
     */
    @Select("select * from tb_user where id=#{id};")
    User selectUserById(Long id);

    /**
     * 查询所有用户信息
     *
     * @param userPageQueryDTO
     * @return
     */
    List<User> listByQuery(UserPageQueryDTO userPageQueryDTO);

    /**
     * 根据账号查询职工信息
     *
     * @param account
     * @return
     */
    @Select("select * from tb_employee where account = #{account}")
    Employee getByAccount(String account);
}
